//
// Created by mio on 25-5-7.
//

#ifndef LOADBLANCESERVER_H
#define LOADBLANCESERVER_H
#include "Loaddefine.h"
#include "../Net/TcpServer.h"

class LoadBlanceServer : public TcpServer, public std::enable_shared_from_this<LoadBlanceServer>
{

public:
    static std::shared_ptr<LoadBlanceServer> Create(EventLoop* eventloop);
    ~LoadBlanceServer();

private:
    friend class LoadBlanceConnection;
    LoadBlanceServer(EventLoop* eventloop);
    virtual TcpConnectionPtr OnConnect(int fd) override;
    void UpdateMonitor(const int fd, Monitor_body* info);
    Monitor_body* GetMonitorInfo();



private:
    EventLoop* loop_;
    std::mutex mtx_;
    std::map<int, Monitor_body*> monitorInfos_;

};

#endif //LOADBLANCESERVER_H